package sicnu.cs.ich.log.config;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import sicnu.cs.ich.log.service.ILogService;

import javax.annotation.PreDestroy;
import java.io.IOException;

/**
 * @author CaiKe
 * @date 2021/12/7 19:14
 */
@Slf4j
@Order(1)
@Component
@RequiredArgsConstructor
public class ListenerConfig implements ApplicationRunner {

    private final ILogService logService;

    @Override
    public void run(ApplicationArguments args) {
    }

    @PreDestroy
    public void preDestroy() throws IOException {
        logService.closeStream();
    }


}